package admin

import (
	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"
	"test_api/controllers"
	"test_api/pkg/logger"
)

type LoginController struct {
}

func (l LoginController) Login(c *gin.Context) {
	// 获取get 传递的参数
	username := c.Query("username")
	password := c.Query("password")
	// 获取POST 传递的参数
	//password := c.PostForm("password")

	logger.Info(logrus.Fields{
		"username": username,
		"password": password,
	}, "用户登录")

	// 把username 和password 一起返回
	controllers.ReturnSuccess(c, 200, "success", gin.H{
		"username": username,
		"password": password,
		"token":    "abcdef",
	})

	//controllers.ReturnError(c, 400, "username")
}
